app.controller("sellerController",function ($scope,$controller,sellerService) {

    $controller('baseController',{$scope:$scope});


    $scope.entity={};

    $scope.isAgree=false;

    $scope.searchEntity = {status:'0'};

    $scope.list=[];

    $scope.add=function (result) {

       if($scope.isAgree){

           //添加操作
           sellerService.save($scope.entity).then(function (result) {

               if(result.data.success){

                   location.href="/shoplogin.html";
               }else {

                   alert(result.data.message);
               }

           });
       } else{

        alert('请先阅读相关规则');
       }

    }
    
    $scope.findOne=function (sellerId) {

        sellerService.findOne(sellerId).then(function(result){
            $scope.entity=result.data;

        });
    }

    $scope.updateStatus=function(status){
        sellerService.updateStatus($scope.entity.sellerId,status).then(function(result){

         if(result.data.success){

             $scope.reloadList();

         }else{

             alert(result.data.message);
         }

        });


    }


    $scope.search=function(page,rows){
        sellerService.findPage(page,rows,$scope.searchEntity).then(function (result) {
            debugger;
           $scope.pageModel.totalItems=result.data.total;

           $scope.list=result.data.rows;

        });

    }



});